//
//  HJDetailCollectionCell.m
//  Sneakers
//
//  Created by 胡光健 on 2017/10/17.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HJDetailCollectionCell.h"
#import "HJHomeModel.h"

@implementation HJDetailCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"HJDetailCollectionCell" owner:self options:nil];
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
    }
    return self;
}

-(void)setModel:(HJHomeDetailCodeModel *)model {
    _model = model;
    
    if ([model.check isEqual:@0]) {
        self.bgView.backgroundColor = HJColorRGB(250);
        self.codel.textColor = HJColorRGB(135);
        self.money.textColor = HJColorRGB(135);
        self.hideLabel.textColor = HJColorRGB(135);
    }else {
        self.bgView.backgroundColor = HJColorRGB(127);
        self.codel.textColor = HJColorRGB(255);
        self.money.textColor = HJColorRGB(255);
        self.hideLabel.textColor = HJColorRGB(255);
    }
    self.codel.text = model.size;
    if (![model.cost isEqualToString:@""]) {
        self.codeY.constant = -10.0f;
    }else {
        self.codeY.constant = 0.0f;
    }
    
    self.money.text = model.cost;
}
@end
